package sys.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sys.dao.MenuDao;
import sys.dao.RoleDao;
import sys.entity.PageData;
import sys.entity.MenuEntity;
import sys.service.MenuService;
import sys.service.RoleService;
import sys.utils.PageUtil;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author Administrator
 */
@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuDao dao;
    @Override
    public void add(MenuEntity entity) {
        dao.add(entity);

    }

    @Override
    public void delete(MenuEntity entity) {
        dao.delete(entity);

    }

    @Override
    public void update(MenuEntity entity) {
        dao.update(entity);

    }

    @Override
    public List<MenuEntity> select(MenuEntity entity) {

        return dao.select(entity);
    }

    @Override
    public PageData<MenuEntity> likeSelect(MenuEntity entity) {
        return PageUtil.getPageData(entity, dao);
    }

    @Override
    public void exportExcel(MenuEntity entity, HttpServletResponse response) {

    }

    @Override
    public Integer selectRole(Integer id) {
        return dao.selectRole(id);
    }

    @Override
    public Integer[] getMenuByUserId(Integer roleId) {
        return dao.getMenuByUserId(roleId);
    }
}
